﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Microsoft.Practices.Repository;
using DotNetCore.BannerManagement.Domain;

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_ImpressionRepositoryArtifacts
{
    /// <summary>
    /// Construct a dnc_Impression object from a datareader.
    /// </summary>
    internal class GetAllFromdnc_ImpressionFactory : IDomainObjectFactory<dnc_Impression>
    {
        public dnc_Impression Construct(IDataReader reader)
        {
            dnc_Impression dnc_Impression = new dnc_Impression();

            int advertisementIDIndex = reader.GetOrdinal("AdvertisementID");
            if (!reader.IsDBNull(advertisementIDIndex))
            {
                dnc_Impression.AdvertisementID = reader.GetInt32(advertisementIDIndex);

            }

            int impressionIndex = reader.GetOrdinal("Impression");
            if (!reader.IsDBNull(impressionIndex))
            {
                dnc_Impression.Impression = reader.GetDateTime(impressionIndex);

            }


            return dnc_Impression;
        }
    }
}

